package club.emergency.wechat.ranking.operate.consumer.service.fallback_factory;

import club.emergency.wechat.common.response.ResponseEntity;
import club.emergency.wechat.common.response.StatusCode;
import club.emergency.wechat.ranking.operate.consumer.service.RankingOperateConsumer;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * Create with IntelliJ IDEA
 * Project Name: wechat
 * Package Name: club.emergency.wechat.ranking.operate.consumer.service.fallback_factory
 * Date: 2019/3/25
 *
 * @author: 快乐的小菌菌
 * Description:
 */
@Component
public class RankingOperateFallbackFactory implements FallbackFactory<RankingOperateConsumer> {
    @Override
    public RankingOperateConsumer create(Throwable throwable) {
        return (staffId, score) -> ResponseEntity.error(StatusCode.REDIS_SAVE_ERROR, "分数增量失败！", throwable.getMessage());
    }
}
